README 

Replication file for "The Supply–Equity Trade-off: The Effect of Spatial Representation on the Local Housing Supply"

Authors: Michael Hankinson (GWU) and Asya Magazinnik (MIT)

Dataverse DOI: https://doi.org/10.7910/DVN/A4XYPS 

---

INCLUDED FILES

All files are described in greater detail in the sections below. 

Codebook: 
	1) codebook.pdf

Analysis Data: 
	2) housing_agg.csv
	3) housing_spatial.csv

Analysis Code:
	4) aggregate_outcomes.R
	5) pretrends.R
	6) pretrends_spatial.R
	7) spatial_outcomes.R
	8) table1.R

Dataset Construction Raw Data: 
	9) ACS_10_5YR_B03002_with_ann.csv
	10) ACS_10_5YR_B25002_with_ann.csv
	11) ACS_10_5YR_B25026_with_ann.csv
	12) ACS_10_5YR_B25077_with_ann.csv
	13) ACS_10_5YR_S1903_with_ann.csv
	14) ACS_11_5YR_B03002_with_ann.csv
	15) ACS_11_5YR_B25002_with_ann.csv
	16) ACS_11_5YR_B25026_with_ann.csv
	17) ACS_11_5YR_B25077_with_ann.csv
	18) ACS_11_5YR_S1903_with_ann.csv
	19) ACS_12_5YR_B03002_with_ann.csv
	20) ACS_12_5YR_B25002_with_ann.csv
	21) ACS_12_5YR_B25026_with_ann.csv
	22) ACS_12_5YR_B25077_with_ann.csv
	23) ACS_12_5YR_S1903_with_ann.csv
	24) ACS_13_5YR_B03002_with_ann.csv
	25) ACS_13_5YR_B11001H_with_ann.csv
	26) ACS_13_5YR_B11001I_with_ann.csv
	27) ACS_13_5YR_B19013_with_ann.csv
	28) ACS_13_5YR_B25002_with_ann_bg.csv
	29) ACS_13_5YR_B25002_with_ann.csv
	30) ACS_13_5YR_B25008_with_ann.csv
	31) ACS_13_5YR_B25026_with_ann.csv
	32) ACS_13_5YR_B25077_with_ann_bg.csv
	33) ACS_13_5YR_B25077_with_ann.csv
	34) ACS_13_5YR_S1903_with_ann.csv
	35) ACS_14_5YR_B03002_with_ann.csv
	36) ACS_14_5YR_B11001H_with_ann.csv
	37) ACS_14_5YR_B11001I_with_ann.csv
	38) ACS_14_5YR_B19013_with_ann.csv
	39) ACS_14_5YR_B25002_with_ann_bg.csv
	40) ACS_14_5YR_B25002_with_ann.csv
	41) ACS_14_5YR_B25008_with_ann.csv
	42) ACS_14_5YR_B25026_with_ann.csv
	43) ACS_14_5YR_B25077_with_ann_bg.csv
	44) ACS_14_5YR_B25077_with_ann.csv
	45) ACS_14_5YR_S1903_with_ann.csv
	46) ACS_15_5YR_B03002_with_ann.csv
	47) ACS_15_5YR_B11001H_with_ann.csv
	48) ACS_15_5YR_B11001I_with_ann.csv
	49) ACS_15_5YR_B19013_with_ann.csv
	50) ACS_15_5YR_B25002_with_ann_bg.csv
	51) ACS_15_5YR_B25002_with_ann.csv
	52) ACS_15_5YR_B25008_with_ann.csv
	53) ACS_15_5YR_B25026_with_ann.csv
	54) ACS_15_5YR_B25077_with_ann_bg.csv
	55) ACS_15_5YR_B25077_with_ann.csv
	56) ACS_15_5YR_S1903_with_ann.csv
	57) ACS_16_5YR_B03002_with_ann.csv
	58) ACS_16_5YR_B11001H_with_ann.csv
	59) ACS_16_5YR_B11001I_with_ann.csv
	60) ACS_16_5YR_B19013_with_ann.csv
	61) ACS_16_5YR_B25002_with_ann_bg.csv
	62) ACS_16_5YR_B25002_with_ann.csv
	63) ACS_16_5YR_B25008_with_ann.csv
	64) ACS_16_5YR_B25026_with_ann.csv
	65) ACS_16_5YR_B25077_with_ann_bg.csv
	66) ACS_16_5YR_B25077_with_ann.csv
	67) ACS_16_5YR_S1903_with_ann.csv
	68) ACS_17_5YR_B03002_with_ann.csv
	69) ACS_17_5YR_B11001H_with_ann.csv
	70) ACS_17_5YR_B11001I_with_ann.csv
	71) ACS_17_5YR_B19013_with_ann.csv
	72) ACS_17_5YR_B25002_with_ann_bg.csv
	73) ACS_17_5YR_B25002_with_ann.csv
	74) ACS_17_5YR_B25008_with_ann.csv
	75) ACS_17_5YR_B25026_with_ann.csv
	76) ACS_17_5YR_B25077_with_ann_bg.csv
	77) ACS_17_5YR_B25077_with_ann.csv
	78) ACS_17_5YR_S1903_with_ann.csv
	79) ACS_18_5YR_B03002_with_ann.csv
	80) ACS_18_5YR_B25002_with_ann.csv
	81) ACS_18_5YR_B25026_with_ann.csv
	82) ACS_18_5YR_B25077_with_ann.csv
	83) ACS_18_5YR_S1903_with_ann.csv
	84) affordability_2020.xlsb
	85) affordability_mh.xlsx
	86) CEDA1998Data.xls
	87) CEDA1999Data.xls
	88) CEDA2000Data.xls
	89) CEDA2001data.xls
	90) CEDA2002Data.xls
	91) CEDA2003Data.xls
	92) CEDA2004Data.xls
	93) CEDA2005Data.xls
	94) CEDA2006Data.xls
	95) CEDA2007Data.xls
	96) CEDA2008Data.xls
	97) CEDA2009Data.xls
	98) CEDA2010Data.xls
	99) CEDA2011Data.xlsx
	100) CEDA2012Data.xlsx
	101) CEDA2013Data.xlsx
	102) CEDA2014Data.xlsx
	103) CEDA2015Data.xlsx
	104) CEDA2016Data.xlsx
	105) CEDA2017Data.xlsx
	106) CEDA2018Data.xlsx
	107) CEDA2019Data.xlsx
	108) cvraCities.csv
	109) cvraPermits - anaheimFinal.csv
	110) cvraPermits - escondidoFinal.csv
	111) cvraPermits - glendaleFinal.csv
	112) cvraPermits - santaBarbaraFinal.csv
	113) cvraPermits - santaCruzFinal.csv
	114) cvraPermits - venturaFinal.csv
	115) DEC_10_SF1_GCTPH1.ST10_with_ann.csv
	116) statewide_2019.csv
	117) statewide_190715.csv
	118) tl_2015_06_bg.cpg
	119) tl_2015_06_bg.dbf
	120) tl_2015_06_bg.prj
	121) tl_2015_06_bg.shp
	122) tl_2015_06_bg.shp.ea.iso.xml
	123) tl_2015_06_bg.shp.iso.xml
	124) tl_2015_06_bg.shp.xml
	125) tl_2015_06_bg.shx
	126) trounstineTheil.tab

Dataset Construction Code:
	127) agg_01_aggregate_reports.R
	128) agg_02_census_inst.R
	129) agg_03_ceda_clean.R
	130) agg_04_ceda_clean_sf.R
	131) agg_05_elec_wru.R
	132) agg_06_elec_wru_sf.R
	133) agg_07_merge_agg.R
	134) spatial_prepare.R
	135) getGeoDetails.R
	136) scrape_anaheim.py
	137) scrape_chulavista.py
	138) scrape_compton.py
	139) scrape_escondido.py
	140) scrape_glendale.py
	141) scrape_ventura.py

Dataset Construction Intermediate Files:  
	142) ceda_agg_sf.csv
	143) ceda_agg.csv
	144) ceda_sf.csv
	145) ceda.csv
	146) city.csv
	147) housing_apr.csv
	148) all_permits_geocoded.csv

---

COMPUTING ENVIRONMENT

- All analyses were carried out on MacOS Monterey Version 12.2.1
- All R analyses were carried out with R version 4.1.3
- Additionally, R analyses use the following packages: 
	- ggplot2 (Version 3.3.5)
	- tidyverse (Version 1.3.1)
	- panelView (Version 1.1.9)
	- multiwayvcov (Version 1.2.3)
	- lmtest (Version 0.9-40)
	- stargazer (Version 5.2.3)
	- fect (Version 0.4.1)
	- bacondecomp (Version 0.1.1)
	- HMisc (Version 4.6-0)
	- clusterSEs (Version 2.6.5)

---

ANALYSIS DATASETS

1) housing_agg.csv
	The city by year data file that is used for our aggregate analysis.

2) housing_spatial.csv
	The block group by year data file that is used for our distributive (case study) analysis. 

---

CODE FOR REPRODUCING ALL RESULTS IN PAPER

1) aggregate_outcomes.R
	Conducts all analyses on the aggregate city-level housing data. Produces: 
	- Table 2
	- Appendix Figure A-1
	- Appendix Figure A-3
	- Appendix Figure A-4
	- Appendix Figure B-7
	- Appendix Figure B-8
	- Appendix Figure B-9
	- Appendix Table A-2
	- Appendix Table B-4
	- Appendix Table B-5
	- Appendix Table B-6
	- Appendix Table B-7	
	- Appendix Table B-8
	- Appendix Table B-9

2) pretrends.R
	Plots aggregate housing units permitted by treatment status and year relative to first district election. Produces:
	- Figure 1
	- Appendix Figure B-5

3) pretrends_spatial.R
	Plots housing units approved by treatment status and year relative to first district election for the case study sample. Produces:
	- Figure 3
	- Appendix Figure C-10 

4) spatial_outcomes.R
	Conducts all analyses on the distributive (case study) housing data. Produces: 
	- Figure 3
	- Table 3
	- Appendix Figure C-11
	- Appendix Figure C-12
	- Appendix Table A-3
	- Appendix Table C-10
	- Appendix Table C-11
	- Appendix Table C-12
	- Appendix Table C-13

5) table1.R
	Summarizes council representation by racial group. Produces: 
	- Table 1

---

CONSTRUCTION OF THE ANALYSIS DATASETS

There are two datasets analyzed in the paper: 

(1) Aggregate housing data (housing_agg.csv)
	
	This dataset is constructed from the authors' original data collection on electoral institutions across California cities over time, along with aggregate housing permit data and controls from the Census. 

	Specifically, it is comprised of the following inputs: 

	I. DEPENDENT VARIABLES

		(1) Housing permits by city 
			Downloaded from: https://socds.huduser.gov/permits/
			File(s): 
			- statewide_190715.csv
			- statewide_2019.csv

		(2) Housing permits by city and affordability status 
			Downloaded from: https://www.hcd.ca.gov/apr-data-dashboard-and-downloads and personal communication with HCD staff via apr@hcd.ca.gov
			File(s): 
			- affordability_mh.xlsx
			- affordability_2020.xlsb

	II. INDEPENDENT VARIABLES

		(1) Authors' original data collection
			File(s): cvraCities.csv

	III. COVARIATES

		(1) Population and race data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_10_5YR_B03002_with_ann.csv
			- ACS_11_5YR_B03002_with_ann.csv
			- ACS_12_5YR_B03002_with_ann.csv
			- ACS_13_5YR_B03002_with_ann.csv
			- ACS_14_5YR_B03002_with_ann.csv
			- ACS_15_5YR_B03002_with_ann.csv
			- ACS_16_5YR_B03002_with_ann.csv
			- ACS_17_5YR_B03002_with_ann.csv
			- ACS_18_5YR_B03002_with_ann.csv

		(2) Income data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_10_5YR_S1903_with_ann.csv
			- ACS_11_5YR_S1903_with_ann.csv
			- ACS_12_5YR_S1903_with_ann.csv
			- ACS_13_5YR_S1903_with_ann.csv
			- ACS_14_5YR_S1903_with_ann.csv
			- ACS_15_5YR_S1903_with_ann.csv
			- ACS_16_5YR_S1903_with_ann.csv
			- ACS_17_5YR_S1903_with_ann.csv
			- ACS_18_5YR_S1903_with_ann.csv

		(3) Occupancy data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_10_5YR_B25002_with_ann.csv
			- ACS_11_5YR_B25002_with_ann.csv
			- ACS_12_5YR_B25002_with_ann.csv
			- ACS_13_5YR_B25002_with_ann.csv
			- ACS_14_5YR_B25002_with_ann.csv
			- ACS_15_5YR_B25002_with_ann.csv
			- ACS_16_5YR_B25002_with_ann.csv
			- ACS_17_5YR_B25002_with_ann.csv
			- ACS_18_5YR_B25002_with_ann.csv

		(4) Home ownership data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_10_5YR_B25026_with_ann.csv
			- ACS_11_5YR_B25026_with_ann.csv
			- ACS_12_5YR_B25026_with_ann.csv
			- ACS_13_5YR_B25026_with_ann.csv
			- ACS_14_5YR_B25026_with_ann.csv
			- ACS_15_5YR_B25026_with_ann.csv
			- ACS_16_5YR_B25026_with_ann.csv
			- ACS_17_5YR_B25026_with_ann.csv
			- ACS_18_5YR_B25026_with_ann.csv

		(5) Home value data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			Stored in: raw/census/value/cdp/
			File(s):
			- ACS_10_5YR_B25077_with_ann.csv
			- ACS_11_5YR_B25077_with_ann.csv
			- ACS_12_5YR_B25077_with_ann.csv
			- ACS_13_5YR_B25077_with_ann.csv
			- ACS_14_5YR_B25077_with_ann.csv
			- ACS_15_5YR_B25077_with_ann.csv
			- ACS_16_5YR_B25077_with_ann.csv
			- ACS_17_5YR_B25077_with_ann.csv
			- ACS_18_5YR_B25077_with_ann.csv

		(6) Population density data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- DEC_10_SF1_GCTPH1.ST10_with_ann.csv

		(7) Segregation data (Trounstine 2016)
			Downloaded from: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/4LZXTY
			Stored in: raw/
			File(s):
			- trounstineTheil.tab

		(8) Election data
			Downloaded from: http://csus-dspace.calstate.edu/handle/10211.3/210187. 
			File(s): 
			- CEDA2019Data.xlsx
			- CEDA2018Data.xlsx
			- CEDA2017Data.xlsx
			- CEDA2016Data.xlsx
			- CEDA2015Data.xlsx
			- CEDA2014Data.xlsx
			- CEDA2013Data.xlsx
			- CEDA2012Data.xlsx
			- CEDA2011Data.xlsx
			- CEDA2010Data.xls
			- CEDA2009Data.xls
			- CEDA2008Data.xls
			- CEDA2007Data.xls
			- CEDA2006Data.xls
			- CEDA2005Data.xls
			- CEDA2004Data.xls
			- CEDA2003Data.xls
			- CEDA2002Data.xls
			- CEDA2001data.xls
			- CEDA2000Data.xls
			- CEDA1999Data.xls
			- CEDA1998Data.xls

	The above inputs are processed by the following scripts. Please run them in the order listed below to reproduce the analysis dataset. Premade copies of all intermediate files (e.g., housing_apr.csv) are also included in replication file. 

		(1) agg_01_aggregate_reports.R
			Processes and combines housing data
			Inputs: All datasets in (I) above
			Output: housing_apr.csv

		(2) agg_02_census_inst.R
			Processes and combines Census data
			Inputs: All datasets in (II) and (III, 1-7) above
			Output: city.csv 

		(3) agg_03_ceda_clean.R
			Processes and combines CEDA election data 
			Inputs: All datasets listed in (III, 8) above 
			Output: ceda.csv

		(4) agg_04_ceda_clean_sf.R
			Processes and combines CEDA election data for San Francisco
			Inputs: All datasets listed in (III, 8) above 
			Output: ceda_sf.csv

		(5) agg_05_elec_wru.R
			Codes ethnicities in election data; creates variables for analysis; aggregates to city-election
			Inputs: 
			- ceda.csv
			- city.csv
			Output: ceda_agg.csv

		(6) agg_06_elec_wru_sf.R
			Codes ethnicities in election data; creates variables for analysis; aggregates to city-election for San Francisco
			Inputs: 
			- ceda.csv
			- city.csv
			Output: ceda_agg_sf.csv

		(3) agg_07_merge_agg.R
			Inputs: 
			- housing_apr.csv
			- city.csv
			- ceda_agg.csv
			- ceda_agg_sf.csv
			Output: housing_agg.csv

(2) Distributive analysis for the case study cities (housing_spatial.csv)

	This dataset is constructed from the authors' original data collection on permits as found in city council minutes, in addition to block group-level controls from the Census.  

	Specifically, it is comprised of the following inputs: 

	I. DEPENDENT VARIABLES

		(1) Housing permits, collected by the authors from city council minutes 
			- cvraPermits - anaheimFinal.csv
			- cvraPermits - escondidoFinal.csv
			- cvraPermits - glendaleFinal.csv
			- cvraPermits - santaBarbaraFinal.csv
			- cvraPermits - santaCruzFinal.csv
			- cvraPermits - venturaFinal.csv

	II. SHAPEFILES

		(1) California block group shapefile from 2015, used for assigning addresses to block groups
			Downloaded from: https://www2.census.gov/geo/tiger/TGRGDB15/
			File(s):
			- tl_2015_06_bg.cpg
			- tl_2015_06_bg.dbf
			- tl_2015_06_bg.prj
			- tl_2015_06_bg.shp
			- tl_2015_06_bg.shp.ea.iso.xml
			- tl_2015_06_bg.shp.iso.xml
			- tl_2015_06_bg.shp.xml
			- tl_2015_06_bg.shx
			* please place these files into a single directory called "tl_2015_06_bg" inside your working directory. 

	III. COVARIATES

		(1) Population and race data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_13_5YR_B11001H_with_ann.csv
			- ACS_14_5YR_B11001H_with_ann.csv
			- ACS_15_5YR_B11001H_with_ann.csv
			- ACS_16_5YR_B11001H_with_ann.csv
			- ACS_17_5YR_B11001H_with_ann.csv
			- ACS_13_5YR_B11001I_with_ann.csv
			- ACS_14_5YR_B11001I_with_ann.csv
			- ACS_15_5YR_B11001I_with_ann.csv
			- ACS_16_5YR_B11001I_with_ann.csv
			- ACS_17_5YR_B11001I_with_ann.csv

		(2) Income data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_13_5YR_B19013_with_ann.csv
			- ACS_14_5YR_B19013_with_ann.csv
			- ACS_15_5YR_B19013_with_ann.csv
			- ACS_16_5YR_B19013_with_ann.csv
			- ACS_17_5YR_B19013_with_ann.csv

		(3) Occupancy data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_13_5YR_B25002_with_ann_bg.csv
			- ACS_14_5YR_B25002_with_ann_bg.csv
			- ACS_15_5YR_B25002_with_ann_bg.csv
			- ACS_16_5YR_B25002_with_ann_bg.csv
			- ACS_17_5YR_B25002_with_ann_bg.csv

		(4) Home ownership data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_13_5YR_B25008_with_ann.csv
			- ACS_14_5YR_B25008_with_ann.csv
			- ACS_15_5YR_B25008_with_ann.csv
			- ACS_16_5YR_B25008_with_ann.csv
			- ACS_17_5YR_B25008_with_ann.csv

		(5) Home value data (Census/ACS)
			Downloaded from: https://factfinder.census.gov
			File(s):
			- ACS_13_5YR_B25077_with_ann_bg.csv
			- ACS_14_5YR_B25077_with_ann_bg.csv
			- ACS_15_5YR_B25077_with_ann_bg.csv
			- ACS_16_5YR_B25077_with_ann_bg.csv
			- ACS_17_5YR_B25077_with_ann_bg.csv

	The above inputs are processed by the following scripts:

		(1) spatial_prepare.R
			Inputs: All datasets in (I)-(III) above
			Outputs: 
			- all_permits_geocoded.csv
			- housing_spatial.csv

		(2) getGeoDetails.R
			Not independently run; used in spatial_prepare.R to geocode addresses. Adapted from Shane Lynn: https://www.shanelynn.ie/massive-geocoding-with-r-and-google-maps/

Additionally, we include the scripts we used to download meeting minutes. These include: 
	- scrape_anaheim.py
	- scrape_chulavista.py
	- scrape_compton.py
	- scrape_escondido.py
	- scrape_glendale.py
	- scrape_ventura.py